package com.puzzlebazar.client.squaregrid.model;

import com.puzzlebazar.client.puzzle.model.Move;
import com.puzzlebazar.client.puzzle.model.MoveNonReversible;
import com.puzzlebazar.client.puzzle.model.MoveVisitor;
import com.puzzlebazar.client.puzzle.model.PuzzleModel;

public class MoveClearStates extends MoveNonReversible {

	/**
	 * 
	 */
	private static final long serialVersionUID = 613644273684461249L;
	
	/**
	 * Only for serialization
	 */
	protected MoveClearStates() {
		super();
	}
	
	public MoveClearStates(long time) {
		super(time);
	}

	@Override
	public void accept(MoveVisitor visitor) throws Exception {
		if( !(visitor instanceof StateMoveVisitor) ) 
			super.accept(visitor);
		else
			((StateMoveVisitor)visitor).visitClearStateMove( this );
	}

	@Override
	public Move apply(PuzzleModel model) throws Exception {
		assert model instanceof StateGrid;
		return ((StateGrid)model).clearStates(time);
	}
}
